<link rel="stylesheet" type="text/css" href="assets/bootstrap-datepicker/css/datepicker.css" />
<aside class="lg-side">
  <div class="panel-heading tab-bg-dark-navy-blue okr-tab-head tab-right "></div>
  <div class="inbox-body mi-h8">
    <div class="row">
      <div class="col-lg-12">
        <section class="panel">
          <header class="panel-heading">
            指标信息
          </header>
          <div class="panel-body">

            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">指标名称*</label>
              <div class="col-sm-10">
                <input type="text" value="" class="form-control" id="wntyName" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" maxlength="50" placeholder="字数限制(50字以内)">
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">指标描述*</label>
              <div class="col-sm-10">
                <textarea class="form-control" id="wntyDesc" maxlength="120" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" placeholder="字数限制(120字以内)"></textarea>
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">完成时间*</label>
              <div class="col-sm-10">
                <input type="text" id="finishTime" value="" class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');">
              </div>
            </div>

            <p class="default-buttons">
              <a href="javascript:void(0);" class="button-back btn btn-info" onclick="toBack()">返回</a>
              <a href="javascript:void(0);" class="button-next  btn btn-info submit">提交</a>
            </p>
          </div>
        </section>
      </div>
    </div>
  </div>
</aside>
<script type="text/javascript" src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script>
  function toUpdateWarn($certusUtils, id) {
    $certusUtils.ajax("findWarn", {
      "id": id
    }, function (response) {
      var data = response.data;
      $("#wntyName").val(data.wntyName);
      $("#wntyDesc").val(data.wntyDesc);
      $("#finishTime").val(data.finishTime);
    });

    $(".submit").on('click', function () {
      var wntyName = $("#wntyName").val();
      if (wntyName == "" || wntyName == undefined || wntyName == null) {
        layer.msg('指标名称不能为空！');
        return;
      }
      var wntyDesc = $("#wntyDesc").val();
      if (wntyDesc == "" || wntyDesc == undefined || wntyDesc == null) {
        layer.msg('指标描述不能为空！');
        return;
      }
      var finishTime = $("#finishTime").val();
      if (finishTime == "" || finishTime == undefined || finishTime == null) {
        layer.msg('完成时间不能为空！');
        return;
      }
      var warnArr = {};
      warnArr.wntyName = wntyName;
      warnArr.wntyDesc = wntyDesc;
      warnArr.finishTime = finishTime;
      warnArr.proId = proId;
      warnArr.id = id;
      $certusUtils.ajax("toAddWarn", {
        "data": JSON.stringify(warnArr),
        "projId": proId
      }, function (response) {
        layer.msg("修改成功");
        toLoadHtml(1);
      });
    })
  }

  function toBack() {
    toLoadHtml(1);
  }
  $('#finishTime').datepicker({
    format: 'yyyy-mm-dd'
  });
</script>